<template>
	<zui-box>
		<!-- 头部导航 -->
		<zui-navbar title="绑定上级"></zui-navbar>
		<u-gap height="30rpx"></u-gap>
		<zui-flat><u-input v-model="account" placeholder="请输入上级邀请码" border="none" color="#fff" clearable></u-input></zui-flat>
		<u-gap height="618rpx"></u-gap>
		<zui-button bgColor="#AA334F" @fun="save">绑定</zui-button>
	</zui-box>
</template>

<script>
export default {
	data() {
		return {
			account: ''
		};
	},
	methods: {
		save() {
			if (!this.account) return uni.$u.toast('请输入上级邀请码');
			uni.$u.http
				.post('/app/user/bindParent', { invite_code: this.account }, { custom: { auth: true, toast: true, catch: true } })
				.then(res => {
					uni.$u.toast('成功');
					setTimeout(() => {
						uni.navigateBack();
					}, 1200);
				})
				.catch(err => {});
		}
	}
};
</script>

<style lang="scss" scoped>
/deep/.u-input__content__field-wrapper__field {
	height: 100rpx !important;
}
</style>
